﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class usercontrol_header_WebUserControl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            String[] user = Session["user"].ToString().Split(',');
            //this.litUser.Text = "( " + user[1] + " )";
            if (Convert.ToInt32(user[0]) > 0)
            {
                this.Ltdangnhap.Text="<a href='http://localhost:2011/didong/users/thoat.html'>Thoát</a>";
                this.linkregister.Visible = false;
                this.Lname.Text = "<a  href='http://localhost:2011/didong/users/thongtincanhan.html'>"+user[1].ToString()+"</a>";
            }
            else
            {
                this.Ltdangnhap.Text = "<a id='ilogin' href='#login'>Đăng nhập</a>";
                
            }

            if (Session["Shopcart"] == null)
            {
                this.linkcart.Text = "Giỏ hàng rỗng";
            }
            else
            {
                int count =int.Parse(Session["count"].ToString());
                this.linkcart.Text = "Có " + count + " sản phẩm";
                this.linkcart.NavigateUrl = "http://localhost:2011/didong/Shoping/giohang.html";
            }
        }
    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        //if (txtsearch.Text.Trim() == "")
        //{
        //    return;
        //}
        //else
        //{
        //    Response.Redirect("http://localhost:2011/didong/search/seachname.aspx?query=" + txtsearch.Text);
        //}
    }
}
